package com.unhz.taigu.service.impl;

import com.unhz.generator.dao.DeliveryInfoMapper;
import com.unhz.generator.pojo.DeliveryInfo;
import com.unhz.taigu.service.DeliveryInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 王林恩
 * @Description:
 * @Date: Created in 上午 9:03 2018/2/1 0001
 * @Modified By:
 */
@Service
public class DeliveryInfoServiceImpl implements DeliveryInfoService {

    @Autowired
    private DeliveryInfoMapper deliveryInfoMapper;

    @Override
    public List<DeliveryInfo> findDeliveryInfoByDeliveryOrderId(Long deliveryOrderId) {
        List<DeliveryInfo> deliveryInfoList = deliveryInfoMapper.selectByDeliveryOrderId(deliveryOrderId);
        return deliveryInfoList;
    }

    @Override
    public int addDeliveryInfo(DeliveryInfo deliveryInfo) {
        int res = deliveryInfoMapper.insertSelective(deliveryInfo);
        return res;
    }

    @Override
    public int deleteDeliveryInfo(Long id) {
        int res = deliveryInfoMapper.deleteByPrimaryKey(id);
        return res;
    }

    @Override
    public int updateDeliveryInfo(DeliveryInfo deliveryInfo) {
        return deliveryInfoMapper.updateByPrimaryKeySelective(deliveryInfo);
    }

    @Override
    public List<DeliveryInfo> selectByDeliveryOrderId(Long deliveryOrderId) {
        return deliveryInfoMapper.selectByDeliveryOrderId(deliveryOrderId);
    }

    @Override
    public void deleteDeliveryOrderInfo(Long deliveryId) {
        deliveryInfoMapper.deleteDeliveryOrderInfo(deliveryId);
    }

    @Override
    public void updateDeliveryOrderInfo(DeliveryInfo deliveryInfo) {
        deliveryInfoMapper.updateDeliveryOrderInfo(deliveryInfo);
    }
}
